<?php

namespace app\admin\controller\user;

use app\common\controller\Backend;
use think\Db;

class Team extends Backend
{
    /**
     * @var \app\admin\model\UserTeam
     */
    protected $model = null;

    public function _initialize()
    {
        parent::_initialize();
        $this->model = model('UserTeam');
        $this->view->assign("statusList", $this->model->getStatusList());
    }
    public function edit($ids = null)
    {
        if ($this->request->isPost()) {
            $params = $this->request->post("row/a");
            if($params['status'] == 1) {
                Db::name('user')->where(['id'=>$params['uid']])->update(['team'=>1]);
            }else{
                Db::name('user')->where(['id'=>$params['uid']])->update(['team'=>0]);
            }
        }
        return parent::edit($ids);
    }
}
